from django.db import models
from django.utils import timezone


# Create your models here.
class Answer(models.Model):
	id = models.AutoField(primary_key=True)
	user = models.IntegerField()
	question1 = models.CharField(max_length=100)
	question2 = models.CharField(max_length=100)
	question3 = models.CharField(max_length=100)
	question4 = models.CharField(max_length=100)
	question5 = models.CharField(max_length=100)
	answer_time = models.DateTimeField('Date/Time Answered', default=timezone.now)

	def __str__(self):
		return self.user

	def return_answer(self):
		return [self.user, self.question1, self.question2, self.question3, self.question4, self.question5,
		        self.answer_time]


class Log(models.Model):
	id = models.AutoField(primary_key=True)
	user = models.ForeignKey(Answer, on_delete=models.CASCADE)
	log_number = models.IntegerField()
	recent_send_date = models.DateTimeField('Date/Time Sent', default=timezone.now)

	def __str__(self):
		return self.log_number


class Question(models.Model):
	id = models.AutoField(primary_key=True)
	question_text = models.CharField(max_length=300)

	def __str__(self):
		return self.question_text


class User(models.Model):
	id = models.AutoField(primary_key=True)
	username = models.CharField(max_length=100)
	password = models.CharField(max_length=100)

	def account(self):
		return [self.username, self.password]
